﻿using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace PoshBoard.VisualDesigner.Controls
{
    public class NewTextBox : TextBox, IPBComponentBase
    {
      
        public string CommandBase { get { return "New-TextBox"; } }

        public string PSName { get; set; }

        public void BuildPSName(string parentName)
        {
            this.PSName = "$" + parentName + "_" + this.Name;
        }

        public string GetParameters()
        {
            string param = PSScriptHelper.GetCommonParameters(this);

            param += " -TextVerticalAlignment " + this.VerticalContentAlignment.ToString();
            param += " -Text " + Common.QuoteChar + this.Text + Common.QuoteChar;
            param += " -AcceptsReturn $" + this.AcceptsReturn.ToString();
            param += " -HorizontalScrollBarVisibility " + this.HorizontalScrollBarVisibility.ToString();
            param += " -VerticalScrollBarVisibility " + this.VerticalScrollBarVisibility.ToString();

            if((this.TextWrapping == System.Windows.TextWrapping.Wrap) || (this.TextWrapping == System.Windows.TextWrapping.WrapWithOverflow))
                param += " -TextWrapping $true";
           
           //Some parameters are renamed in the PS module for being user friendly
            param = param.Replace("-TextAlignment", "-TextHorizontalAlignment");

            return param;
        }

        public string GetConstructionScript()
        {
            return PSScriptHelper.BuildPSScript(this, this.Name, null);
        }
    }
}
